<?php
class I18nUtilities
{
  const DATE_SHORT = 0;
  const DATE_MIDDLE = 1;
  const DATE_LONG = 2;
  
  const DAY_MONDAY = 0;
  const DAY_TUESDAY = 1;
  const DAY_WEDNESDAY = 2;
  const DAY_THURSDAY = 3;
  const DAY_FRIDAY = 4;
  const DAY_SATURDAY = 5;
  const DAY_SUNDAY = 6;
  
  public static function getDateFormat($type = self::DATE_SHORT)
  {
    return 'd-m-Y';
    switch ( $type )
    {
      case self::DATE_SHORT:
        //return sfDateTimeFormatInfo::getInstance(sfContext::getInstance()->getUser()->getCulture())->getShortDatePattern();
        
        break;
      case self::DATE_MIDDLE:
        //return sfDateTimeFormatInfo::getInstance(sfContext::getInstance()->getUser()->getCulture())->getMediumDatePattern();
        return '';                
        break;
      case self::DATE_LONG:
        //return sfDateTimeFormatInfo::getInstance(sfContext::getInstance()->getUser()->getCulture())->getLongDatePattern();
        break;
    }
  }

  public static function __($text, $args = array(), $catalogue = 'messages')
  { 
    return sfContext::getInstance()->getI18N()->__($text, $args, $catalogue);
  }
  
  public static function getNotAvailable()
  {
    return self::__('N/A');
  }

  public static function getNotAvailableIfIsNull($value)
  {
    return trim($value) ? $value : self::getNotAvailable();
  }
  
  public static function getDayName($day)
  {
    switch ($day)
    {
      case self::DAY_FRIDAY:
        return self::__('Friday');
      case self::DAY_THURSDAY:
        return self::__('Thursday');
      case self::DAY_WEDNESDAY:
        return self::__('Wednesday');
      case self::DAY_TUESDAY:
        return self::__('Tuesday');
      case self::DAY_MONDAY:
        return self::__('Monday');
      case self::DAY_SUNDAY:
        return self::__('Sunday');
      case self::DAY_SATURDAY:
        return self::__('Saturday');
    }
  }
  
  public static function getCountry($country_value){
      $culture =sfContext::getInstance()->getUser()->getCulture();
      $contries = sfCultureInfo::getInstance($culture)->getCountries();
      return $contries[$country_value];
  }
  
}
